<!--/////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Autodesk, Inc. All rights reserved
// Written by Philippe Leefsma 2016 - ADN/Developer Technical Services
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
////////////////////////////////////////////////////////////////////////////////-->
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, height=device-height, minimal-ui, minimum-scale=1.0, initial-scale=1, user-scalable=no"/>
  <link rel="stylesheet" href="viewer-lib/style.css" type="text/css"/>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <title>Viewer - Offline</title>

  <style>

    body{
      margin:0
    }

    .viewer {
      position: relative
      height: 100vh
      width: 100vw
    }

  </style>

</head>

<body>

  <script src="viewer-lib/three.min.js"></script>
  <script src="viewer-lib/viewer3D.js"></script>

  <div id="viewer" class="viewer">
  </div>

  <script>

    /////////////////////////////////////////////////////////////////
    // Initialization Options
    //
    /////////////////////////////////////////////////////////////////
    var initOptions = {
      path: Autodesk.Viewing.Private.getParameterByName('path') || './v8/0.svf',
      env: 'Local'
    }

    /////////////////////////////////////////////////////////////////
    // Environment Initialized Handler
    //
    /////////////////////////////////////////////////////////////////
    function onEnvInitialized () {

      var domContainer = document.getElementById('viewer')

      // UI-less Version: viewer without controls and commands
      //viewer = new Autodesk.Viewing.Viewer3D(domContainer)

      // GUI Version: viewer with controls
      var viewer = new Autodesk.Viewing.Private.GuiViewer3D(domContainer)

      viewer.initialize()

      viewer.loadModel(initOptions.path)
    }

    /////////////////////////////////////////////////////////////////
    // Error Handler
    //
    /////////////////////////////////////////////////////////////////
    function onLoadError (errCode) {

      console.log('Error loading document: ' + errCode)
    }

    /////////////////////////////////////////////////////////////////
    // Bootstraping
    //
    /////////////////////////////////////////////////////////////////
    Autodesk.Viewing.Initializer(
      initOptions,
      function() {
        onEnvInitialized ()
      })

  </script>

</body>
</html>